PR #1028: TPC Model Implementation for ICU Length-of-Stay Prediction#1060
Closed
tarakjc2c wants to merge 22 commits intosunlabuiuc:masterfrom
Closed
PR #1028: TPC Model Implementation for ICU Length-of-Stay Prediction#1060tarakjc2c wants to merge 22 commits intosunlabuiuc:masterfrom
tarakjc2c wants to merge 22 commits intosunlabuiuc:masterfrom
Conversation
- Implement TPC (Temporal Pointwise Convolutional) model for length-of-stay prediction - Add RemainingLOSMIMIC4 task for MIMIC-IV dataset - Create 12 comprehensive unit tests (all passing) - Add complete API documentation (RST files) - Include ablation study script with 4 configurations + MC Dropout - Fix: dtype bug in tpc.py line 519, BatchNorm edge cases - All existing tests pass (no regressions) Note: Ablation study requires 16GB+ RAM due to large MIMIC-IV chartevents (3.5GB). Groupmates with adequate resources can run: examples/length_of_stay/length_of_stay_mimic4_tpc.py
- Synthetic MIMIC-IV data generation (300 patients, 34 features) - Complete training pipeline with PyHealth integration - Ablation study: baseline (2.727d MAE), shallow (2.506d MAE), high_dropout (2.750d MAE) - Best configuration: shallow_network (1-layer TPC) - Demonstrates: dataset creation, model training, evaluation, results export - Extra credit: 10 points
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR #1028: TPC Model Implementation for ICU Length-of-Stay Prediction
Contributors
Pankaj Meghani (meghani3), Tarak Jha (tarakj2), Pranash Krishnan (pranash2)
Summary
This PR implements the Temporal Pointwise Convolutional Networks (TPC) model from Rocheteau et al. (CHIL 2021) for ICU length-of-stay prediction in the PyHealth framework.
https://arxiv.org/abs/2007.09483
Implementation Overview
1. Model Implementation (
pyhealth/models/tpc.py)MSLELoss: Mean Squared Log Error for balanced predictions across skewed LoS distributionMaskedMSELoss: Handles missing data (critical for ICU datasets with 90% missingness)predict_with_uncertainty()method implementing Monte Carlo Dropout for clinical decision support2. Data Pipeline (
pyhealth/tasks/length_of_stay_tpc_mimic4.py)3. Comprehensive Testing (
tests/core/test_tpc.py)4. Complete Documentation
docs/api/models/pyhealth.models.tpc.rstdocs/api/tasks/pyhealth.tasks.length_of_stay_tpc_mimic4.rstdocs/api/models.rst,docs/api/tasks.rst5. Example Script
examples/length_of_stay/length_of_stay_mimic4_tpc.pyKey Features
Architecture Innovations
Novel Extension: Monte Carlo Dropout Uncertainty
Testing Results
$ pytest tests/core/test_tpc.py -v ========================== 12 passed in 17.93s ==========================Test Coverage:
Reproduction Notes
What We Implemented
Computational Constraints
The full ablation study requires >8GB RAM for MIMIC-IV dataset processing (chartevents.csv.gz expands from 3.5GB to ~15GB in memory). Our development machines (8GB RAM) consistently hit
MemoryError.Per instructor guidance: We validated all functionality through comprehensive unit tests and synthetic data demonstrations. The implementation is complete and ready for deployment when appropriate computational resources are available.
Validation Approach
Paper Reference
Title: Temporal Pointwise Convolutional Networks for Length of Stay Prediction in the Intensive Care Unit
Authors: Emma Rocheteau, Pietro Liò, Stephanie Hyland
Venue: CHIL 2021 (Conference on Health, Inference, and Learning)
Paper: Proceedings of Machine Learning Research, vol 149, pages 58-68
Results (MIMIC-IV):
Files Changed
Core Implementation:
pyhealth/models/tpc.py- Model implementation (505 lines)pyhealth/models/__init__.py- Model registrationpyhealth/tasks/length_of_stay_tpc_mimic4.py- Data pipelinetests/core/test_tpc.py- Comprehensive tests (12 tests)Documentation:
docs/api/models/pyhealth.models.tpc.rstdocs/api/tasks/pyhealth.tasks.length_of_stay_tpc_mimic4.rstdocs/api/models.rst,docs/api/tasks.rst- Index updatesExamples & Resources:
examples/length_of_stay/length_of_stay_mimic4_tpc.pytest-resources/core/mimic4demo/icu/d_items.csv.gztest-resources/core/mimic4demo/icu/chartevents.csvSupporting:
pyhealth/datasets/configs/mimic4_ehr.yaml- Chartevents support